// Candidate.java
//
// ICS 22 / CSE 22 Winter 2010
// Project #1: Perfect Candidate
//
// The Candidate class encapsulates the notion of a candidate on a ballot.
// The relevant information about a candidate is his/her name, party
// affiliation, and how many votes the candidate has received so far.

public class Candidate {
	private String m_name, m_affiliation;
	private int m_voteCount;

	// The constructor takes a name and a party affiliation and initializes
	// a newly-created candidate. A newly-created candidate should have
	// a vote count of 0.
	public Candidate(String name, String affiliation) {
		m_name = name;
		m_affiliation = affiliation;
		m_voteCount = 0;
	}

	// getName() returns the name of this candidate.
	public String getName() {
		return m_name;
	}

	// getAffiliation() returns the party affiliation of this candidate.
	public String getAffiliation() {
		return m_affiliation;
	}

	// getVoteCount() returns the number of votes received by this
	// candidate so far.
	public int getVoteCount() {
		return m_voteCount;
	}

	// tallyVote() tallies one vote for this candidate, increasing his/her
	// vote count by 1.
	public void tallyVote() {
		m_voteCount++;
	}

	// toString() takes the name and affiliation of a candidate and converts
	// it to a string in the following format:
	//
	// * If the name is "Alex" and the affiliation is "ICS", toString()
	// should return "Alex - ICS".
	public String toString() {
		return new String(m_name + " - " + m_affiliation);
	}
}
